﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkflowCore.Models;
using WorkflowCore2210A.Application.Dto;
using WorkflowCore2210A.Application.Dto.Input;
using WorkflowCore2210A.Application.Dto.Output;
using WorkflowCore2210A.Domain.Model;

namespace WorkflowCore2210A.Application
{
    public interface IWorkflowService
    {
        /// <summary>
        /// 添加流程定义
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        ApiResult<int> AddWorkflowDefinition(WorkflowDefinitionInput input);

        /// <summary>
        /// 加载流程定义到引擎中
        /// </summary>
        /// <param name="model"></param>
        void LoadDefinition(WorkflowDefinitionModel model);

        /// <summary>
        /// 添加审批记录
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        int AddAudit(AddAuditInput input);

        /// <summary>
        /// 更新审批记录
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        int UpdateAudit(UpdateAuditInput input);

        /// <summary>
        /// 判断是否有权限审批
        /// </summary>
        /// <param name="workflowId">流程实例ID</param>
        /// <param name="userId">待审批用户</param>
        /// <param name="stepId">当前审批步骤</param>
        /// <returns></returns>
        bool HasAudit(string workflowId, long userId);

        /// <summary>
        /// 添加流程业务实例
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        int AddWorkflowInstance(AddWorkflowInstanceInput input);

        /// <summary>
        /// 流程定义分页查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        ApiPaging<WorkflowDefinitionOutput> GetWorkflowDefinitionList(PageInput input);


        /// <summary>
        /// 流程实例查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        ApiPaging<WorkflowInstanceOutput> GetWorkflowInstanceList(QueryWorkflowInstalceInput input);

        /// <summary>
        /// 获取我的待办
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        ApiPaging<AuditOutput> GetAuditList(PageInput input, long userId);

        /// <summary>
        /// 保存表单模版
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        ApiResult<int> SaveFormTemplate(SaveFormTemplateInput input);

        /// <summary>
        /// 获取表单模版
        /// </summary>
        /// <param name="definitionModelId"></param>
        /// <returns></returns>
        ApiResult<FormTemplateOutput> GetFormTemplate(long definitionModelId);

        /// <summary>
        /// 获取流程实例详情
        /// </summary>
        /// <param name="workflowId"></param>
        /// <returns></returns>
        ApiResult<WorkflowInstalceDetailOutput> GetWorkflowDetail(string workflowId);
        
    }
}
